using System;
using System.Collections.Generic;
using System.Text;
namespace MicroMsg.Common.Algorithm
{
	public class SupportClass
	{
		public class StackSupport
		{
			public static object Pop(List<object> stack)
			{
				object result = stack.get_Item(stack.get_Count() - 1);
				stack.RemoveAt(stack.get_Count() - 1);
				return result;
			}
		}
		public static int URShift(int number, int bits)
		{
			if (number >= 0)
			{
				return number >> bits;
			}
			return (number >> bits) + (2 << ~bits);
		}
		public static int URShift(int number, long bits)
		{
			return SupportClass.URShift(number, (int)bits);
		}
		public static long URShift(long number, int bits)
		{
			if (number >= 0L)
			{
				return number >> bits;
			}
			return (number >> bits) + (2L << ~bits);
		}
		public static long URShift(long number, long bits)
		{
			return SupportClass.URShift(number, (int)bits);
		}
		public static long Identity(long literal)
		{
			return literal;
		}
		public static ulong Identity(ulong literal)
		{
			return literal;
		}
		public static float Identity(float literal)
		{
			return literal;
		}
		public static double Identity(double literal)
		{
			return literal;
		}
		public static byte[] ToByteArray(sbyte[] sbyteArray)
		{
			byte[] array = null;
			if (sbyteArray != null)
			{
				array = new byte[sbyteArray.Length];
				for (int i = 0; i < sbyteArray.Length; i++)
				{
					array[i] = (byte)sbyteArray[i];
				}
			}
			return array;
		}
		public static byte[] ToByteArray(string sourceString)
		{
			return Encoding.get_UTF8().GetBytes(sourceString);
		}
		public static byte[] ToByteArray(object[] tempObjectArray)
		{
			byte[] array = null;
			if (tempObjectArray != null)
			{
				array = new byte[tempObjectArray.Length];
				for (int i = 0; i < tempObjectArray.Length; i++)
				{
					array[i] = (byte)tempObjectArray[i];
				}
			}
			return array;
		}
		public static sbyte[] ToSByteArray(byte[] byteArray)
		{
			sbyte[] array = null;
			if (byteArray != null)
			{
				array = new sbyte[byteArray.Length];
				for (int i = 0; i < byteArray.Length; i++)
				{
					array[i] = (sbyte)byteArray[i];
				}
			}
			return array;
		}
		public static char[] ToCharArray(sbyte[] sByteArray)
		{
			return Encoding.get_UTF8().GetChars(SupportClass.ToByteArray(sByteArray));
		}
		public static char[] ToCharArray(byte[] byteArray)
		{
			return Encoding.get_UTF8().GetChars(byteArray);
		}
	}
}
